<?php

error_reporting(E_ALL);

/**
 * ELEARNING - class.ControladorDetalle.php
 *
 * $Id$
 *
 * This file is part of ELEARNING.
 *
 * Automatically generated on 07.12.2011, 22:21:54 with ArgoUML PHP module 
 * (last revised $Date: 2010-01-12 20:14:42 +0100 (Tue, 12 Jan 2010) $)
 *
 * @author firstname and lastname of author, <author@example.org>
 */

if (0 > version_compare(PHP_VERSION, '5')) {
    die('This file was generated for PHP 5');
}

/**
 * include Detalle
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.Detalle.php');

/**
 * include ModeloDetalle
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.ModeloDetalle.php');

/**
 * include Usuarios
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.Usuarios.php');

/**
 * include VistaDetalle
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.VistaDetalle.php');

/* user defined includes */
// section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BB3-includes begin
// section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BB3-includes end

/* user defined constants */
// section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BB3-constants begin
// section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BB3-constants end

/**
 * Short description of class ControladorDetalle
 *
 * @access public
 * @author firstname and lastname of author, <author@example.org>
 */
class ControladorDetalle
{
    // --- ASSOCIATIONS ---


    // --- ATTRIBUTES ---

    /**
     * Short description of attribute modelo
     *
     * @access public
     * @var ModeloDetalle
     */
    public $modelo = null;

    /**
     * Short description of attribute vista
     *
     * @access public
     * @var VistaDetalle
     */
    public $vista = null;

    /**
     * Short description of attribute usuario
     *
     * @access public
     * @var Usuarios
     */
    public $usuario = null;

    /**
     * Short description of attribute mensaje
     *
     * @access public
     * @var String
     */
    public $mensaje = null;

    /**
     * Short description of attribute detalle
     *
     * @access public
     * @var Detalle
     */
    public $detalle = null;

    // --- OPERATIONS ---

    /**
     * Short description of method Lista
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Lista()
    {
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BC4 begin
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BC4 end
    }

    /**
     * Short description of method Alta
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Alta($valorcurso,$valorid)
    {
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BC6 begin
		$cadena= $this->modelo->InsertRow($valorcurso,$valorid);
		$this->Mostrar($valorcurso);
				exit();
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BC6 end
    }

    /**
     * Short description of method Borrar
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Borrar($id,$idcurso)
    {
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BC8 begin
		$this->modelo->DeleteRow($id);
		$this->Mostrar($idcurso);
				exit();
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BC8 end
    }

    /**
     * Short description of method Mostrar
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Mostrar($valorid)
    {
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BCA begin
	
				$cadena= $this->modelo->GetId($valorid);
				$this->vista->Editar("header.php",$cadena);
				$this->vista->Editar("VistaDetalleCursos.php",$cadena);
				$this->vista->Editar("footer.php",$cadena);
				exit();
				
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BCA end
    }

    /**
     * Short description of method Editar
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Editar()
    {
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BD3 begin
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BD3 end
    }

    /**
     * Short description of method ControladorDetalle
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function ControladorDetalle()
    {
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BD7 begin
		$this->modelo = new ModeloDetalle();		
		$this->vista = new VistaDetalle();
		$this->usuarios = new Usuarios;
		$this->detalle = new Detalle();
		
		if ($this->usuarios->IsLogged()==true && @$_REQUEST['opcion'] == null && @$_REQUEST['agregar'] == null && @$_REQUEST['salir'] == null) 
		{	
			$this->Mostrar(@$_REQUEST['id']);		
		}else
		{
			if(@$_REQUEST['salir'] != null)
			{
				$this->usuario->LogOut();
			}
			elseif(@$_REQUEST['agregar'])
			{
				$this->Alta(@$_REQUEST['idcurso'],@$_REQUEST['actividad']);
			}
			elseif(@$_REQUEST['opcion'] == 'desplegar')
			{
				$this->Borrar(@$_REQUEST['id'],@$_REQUEST['idcurso']);
			}
			
		}
        // section 127-0-0-1--5d6a0cd9:1341be662d9:-8000:0000000000000BD7 end
    }

} /* end of class ControladorDetalle */

?>